import create from '../../utils/create2.js'
import SystemUtil from '../../shell/system/system.js';
create({
  /**
   * 页面的初始数据
   * tagId：单页id
   * tagType_list：单页内容
   * imageSize：图片高度
   */
  properties: {
    list:{
      type: Array,
      value: []
    }
  },
  data: {
    show: false,
    windowHeight: 0
  },
  ready() {
    this.getHeight();
  },
  methods: {
    /*
        * 获取屏幕宽度
        */
    getHeight () {
      this.setData({
        windowHeight: SystemUtil.getSystemInfo(false).windowHeight
      })
    },
    /**
     * 点击处理
     */
    clicks: function (e) {
      var id = e.currentTarget.id;
      wx.navigateTo({
        url: '/pages/index/foodform/index?id=' + id
      })
    },
    dinner(e) {
      const { dataset } = e.currentTarget
      const { id, index } = dataset
      const { list } = this.data
      this.store.data.dinner = list[index]
      this.triggerEvent('hide')     
    },

    hide () {
      this.setData({ show: false })
    },
    show(){
      this.setData({show: true})
    }
  }
})